using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper.Contrib.Extensions;
using Publicuse.Entity.AttributeUtil;
using SqlSugar;

namespace Publicuse.Entity
{
  /// <summary>
  /// 用户信息
  /// </summary>
  [DBTable("`geeker-user`", "用户信息")]
  [Table("`geeker-user`")]
  [SugarTable("`geeker-user`")]
  public partial class User : BaseModel<long>
  {
    [Remark("是否需要修改密码")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public bool isNeedUpdatePwd { get; set; } = false;

    [Remark("是否需要修改密码")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string needUpdatePwdMsg { get; set; }

    [Remark("是否重置密码")]
    [NoQuery]
    public string resetpwd { get; set; }

    [Remark("国家")]
    public string country { get; set; }

    [Remark("绑定手机号时间")]
    public string bindTime { get; set; }

    [Remark("是否关联用户")]
    public string associateuon { get; set; }

    [Remark("关联用户")]
    public string associateuonuser { get; set; }

    [Remark("登录类型：后台登录、小程序登录、后台小程序登录")]
    [NoQuery]
    public string LoginType { get; set; }

    [Remark("登录时间")]
    public string logintime { get; set; }

    [Remark("用户名称")]
    public string uName { get; set; }

    [Remark("用户密码")]
    public string uPwd { get; set; }

    [Remark("用户邮箱")]
    public string uEmail { get; set; }

    [Remark("用户电话")]
    public string uPhone { get; set; }

    [Remark("用户手机")]
    public string uMobile { get; set; }

    [Remark("用户账号")]
    public string uCode { get; set; }

    [Remark("用户年龄")]
    public string uAge { get; set; }

    [Remark("用户性别")]
    public string uSex { get; set; }

    [Remark("用户出生日期")]
    public string uBirthday { get; set; }

    [Remark("修改密码时间")]
    public string lasttimeupw { get; set; }

    [Remark("证件类型：1-身份证，2-军官证，3-护照，4-外国人居住证，5-台胞证，6-港澳回乡证，0-未选择")]
    public string uIdCardType { get; set; } = string.Empty;

    [Remark("用户证件号码")]
    public string uIdCardNo { get; set; }

    [Remark("权限标识ID")]
    public string appid { get; set; }

    [Remark("头像路径")]
    public string uploadyhead { get; set; }

    [Remark("省市区")]
    public string pca { get; set; }

    [Remark("街道")]
    public string address { get; set; }

    [Remark("登录系统密码错误锁定登录系统时间")]
    public string retrytime { get; set; }

    [Remark("登录系统密码错误重试次数")]
    public int retrycount { get; set; } = -1;

    [Remark("所属角色")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string rName { get; set; }

    [Remark("所属角色")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string rId { get; set; }

    [Remark("所属学校")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string sId { get; set; }

    [Remark("所属学校")]
    [SugarColumn(IsIgnore = true)]
    [System.ComponentModel.DataAnnotations.Schema.NotMapped]
    public string schoolid { get; set; }

    [Remark("所属学校")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string schoolname { get; set; }

    [Remark("编号查询")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string Idb { get; set; }

    [Remark("填报用户")]
    [Write(false)]
    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public string reporting { get; set; }

    [Remark("最后登录时间")]
    [SugarColumn(IsIgnore = true)]
    [NoQuery]
    public string logintimest { get; set; }

    [Remark("最后登录时间")]
    [SugarColumn(IsIgnore = true)]
    [NoQuery]
    public string logintimeet { get; set; }

    [SugarColumn(IsIgnore = true)]
    [NoQuery]
    public string parentName { get; set; }

    [SugarColumn(IsIgnore = true)]
    [NoQuery]
    public bool ischecked { get; set; } = false;

    [NoQuery]
    [SugarColumn(IsIgnore = true)]
    public int checkedindex { get; set; } = 10000;

    [Remark("资源名称")]
    [SugarColumn(IsIgnore = true)]
    [System.ComponentModel.DataAnnotations.Schema.NotMapped]
    public string resName { get; set; }

    [Remark("省市区")]
    [SugarColumn(IsIgnore = true)]
    [NoQuery]
    public string pcaremark { get; set; }

    public User()
    {
      this.Id = 0;
    }
  }

  /// <summary>
  /// 用户查询参数
  /// </summary>
  public class UserQuery : CommonQuery
  {
    public string sName { get; set; }

    public string uCode { get; set; }

    public string uName { get; set; }

    public string uMobile { get; set; }

    public string cTime { get; set; }

    public int sysmoduleid { get; set; } = -1;

    public UserQuery()
    {
      this.exportName = GetExportName;
      this.businessType = BusinessType.user;
    }

    public static string GetExportName
    {
      get { return "user"; }
    }
  }

  /// <summary>
  /// 用户登录密码修改
  /// </summary>
  public class UserPwd
  {
    public string Id { get; set; }

    public string oldPassword { get; set; }

    public string newPassword { get; set; }
  }

  /// <summary>
  /// 登录用户角色信息
  /// </summary>
  public class UserLoginResult
  {
    /// <summary>
    /// 头像图片路径
    /// </summary>
    public string uploadyhead { get; set; } = string.Empty;

    /// <summary>
    /// 是否需要修改登录密码
    /// </summary>
    public bool isNeedUpdatePwd { get; set; } = false;

    public string needUpdatePwdMsg { get; set; } = string.Empty;

    /// <summary>
    /// 所属部门
    /// </summary>
    public string dName { get; set; }

    /// <summary>
    /// 登录角色名称
    /// </summary>
    public string rName { get; set; }

    /// <summary>
    /// 登录用户用户角色ID
    /// </summary>
    public string rIds { get; set; }

    /// <summary>
    /// 登录token
    /// </summary>
    public string token { get; set; }

    /// <summary>
    /// 操作权限token
    /// </summary>
    public string authtoken { get; set; }

    /// <summary>
    /// 登录用户所属系统模块
    /// </summary>
    public string sysModule { get; set; }

    /// <summary>
    /// 登录用户所属系统模块主题皮肤
    /// </summary>
    public string skintheme { get; set; }

    /// <summary>
    /// 登录用户信息
    /// </summary>
    public User user { get; set; }

    /// <summary>
    /// 文件预览地址
    /// </summary>
    public string previewpath { get; set; }

    /// <summary>
    /// 登录用户角色资源信息
    /// </summary>
    public List<Menu> list { get; set; }

    public UserLoginResult()
    {
      this.user = new User();
      this.list = new List<Menu>();
    }
  }

  /// <summary>
  /// 登录用户角色权限资源信息
  /// </summary>
  public class UsrRoleModule
  {
    public List<UserModule> userModules { get; set; }

    public UsrRoleModule()
    {
      this.userModules = new List<UserModule>();
    }
  }

  /// <summary>
  /// 登录用户角色权限资源信息-模块信息
  /// </summary>
  public class UserModule
  {
    public string name { get; set; }

    public int amoduleIndex { get; set; }

    public string ahtmlIcon { get; set; }

    public string aCode { get; set; }

    public List<UserMenu> userMenu { get; set; }

    public List<UserAction> userAction { get; set; }

    public UserModule()
    {
      this.userMenu = new List<UserMenu>();

      this.userAction = new List<UserAction>();
    }
  }

  /// <summary>
  /// 登录用户角色权限资源信息-菜单信息
  /// </summary>
  public class UserMenu
  {
    public string name { get; set; }

    public string url { get; set; }

    public bool ismenu { get; set; }

    public string ahtmlIcon { get; set; }

    public int amoduleIndex { get; set; }

    public string aCode { get; set; }

    public long aId { get; set; }

    public List<UserMenub> childMenus { get; set; }

    public UserMenu()
    {
      this.childMenus = new List<UserMenub>();
    }
  }

  /// <summary>
  ///  登录用户角色权限资源信息菜单信息
  /// </summary>
  public class UserMenub
  {
    public string name { get; set; }

    public string url { get; set; }

    public string ahtmlIcon { get; set; }

    public int amoduleIndex { get; set; }

    public string aCode { get; set; }

    public long aId { get; set; }

    public List<UserMenu> userMenu { get; set; }

    public UserMenub()
    {
      this.userMenu = new List<UserMenu>();
    }
  }

  /// <summary>
  /// 登录模型
  /// </summary>
  public class UserLogin
  {
    /// <summary>
    /// 账号
    /// </summary>
    public string name { get; set; }

    /// <summary>
    /// 密码
    /// </summary>
    public string pwd { get; set; }

    /// <summary>
    /// 时间戳
    /// </summary>
    public string timestamp { get; set; }

    /// <summary>
    /// 验证码
    /// </summary>
    public string verify { get; set; }
  }

  /// <summary>
  /// 上传用户头像
  /// </summary>
  public class UploadYPhoto
  {
    public string uid { get; set; }

    public string logincode { get; set; }
  }

  public class UserRoleAuthor
  {
    public string uCode { get; set; }

    public string uName { get; set; }

    public string rname { get; set; }

    public string aname { get; set; }
  }

  public class UserRoleCompany
  {
    public string rname { get; set; }

    public string uname { get; set; }

    public string ucode { get; set; }

    public string upass { get; set; }

    public string resourcelist { get; set; }

    public List<string> authoritys { get; set; }

    public string companylist { get; set; }

    /// <summary>
    /// 排序ID
    /// </summary>
    public int sIndex { get; set; }

    /// <summary>
    /// 1=审核管理角色  2=企业上报角色 3=其他角色
    /// </summary>
    public int uType { get; set; }
  }

  public class SaveUserRole
  {
    public string uids { get; set; }

    public string rids { get; set; }

    public string aids { get; set; }
  }

  #region 解绑数据相关模型
  public class Unbinddata
  {
    public int type { get; set; } = 0;
    public long Id { get; set; }
    public long rId { get; set; }
    public long aId { get; set; }
    public long schoolid { get; set; }

    public string data { get; set; } = string.Empty;
  }
  #endregion
}
